﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Model;
using System.Data.Linq;

namespace BL
{
    public class AppHandler
    {

        public List<Applicaty> GetAllApps()
        {
            List<Applicaty> allappslist = new List<Applicaty>();
            dbopenleuvenDataContext db = new dbopenleuvenDataContext();
            var result = from a in db.Applicaties where a.AppStatus == 2 select a;

            allappslist = result.ToList();

            return allappslist;


        }


        public List<Applicaty> GetUserApps(int usid)
        {
            List<Applicaty> userappslist = new List<Applicaty>();
            dbopenleuvenDataContext db = new dbopenleuvenDataContext();
            var result = from a in db.Applicaties join uf in db.UserFavourites on a.AppID equals uf.AppID join u in db.Gebruikers on uf.UserID equals u.UserID where u.UserID == usid select a;

            userappslist = result.ToList();

            return userappslist;
        }


        public void InsertDevApp(int devid, Applicaty newapp)
        {


        }


        public void ApproveApp(int appid)
        {


        }


        public void DenyApp(int appid)
        {


        }

    }
}
